﻿using System.ComponentModel;

namespace Airborne.ScrumPoker.Model.Cards
{
    public class SimpleCard : ICard
    {
        #region Fields
        private object cardFaceValue;
        private double actualValue;
        private bool isSelected;
        #endregion

        #region ICard Members

        public object CardDeck
        {
            get
            {
                return "/Airborne.ScrumPoker;component/Resources/Images/Card.png";
            }
        }
        public object CardFaceValue
        {
            get
            {
                return cardFaceValue;
            }
            set
            {
                if (cardFaceValue != value)
                {
                    cardFaceValue = value;
                    RaisePropertyChanged("CardFaceValue");
                }
            }
        }

        public double ActualValue
        {
            get
            {
                return actualValue;
            }
            set
            {
                if (actualValue != value)
                {
                    actualValue = value;
                    RaisePropertyChanged("ActualValue");
                }
            }
        }

        public bool IsSelected
        {
            get
            {
                return isSelected;
            }
            set
            {
                if (isSelected != value)
                {
                    isSelected = value;
                    RaisePropertyChanged("IsSelected");
                }
            }
        }
        #endregion

        #region INotifyPropertyChanged Members


        #region PropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventArgs args = new PropertyChangedEventArgs(propertyName);
            OnPropertyChanged(args);
        }

        protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, args);
            }
        }

        #endregion

        #endregion
    }
}
